//
//  MDRegisterViewController.m
//  MvvmDemo
//
//  Created by 吴伟城 on 2018/12/16.
//  Copyright © 2018 吴伟城. All rights reserved.
//

#import "MDRegisterViewController.h"

@import Masonry;

@interface MDRegisterViewController ()

@property (weak, nonatomic) id<MDRegisterViewControllerDelegate> delegate;

@end

@implementation MDRegisterViewController

- (instancetype)initWithDelegate:(id<MDRegisterViewControllerDelegate>)delegate {
  if (self = [self init]) {
    _delegate = delegate;
  }
  return self;
}

- (void)viewDidLoad {
  [super viewDidLoad];
  [self makeUI];
}

- (void)makeUI {
  self.view.backgroundColor = [UIColor whiteColor];
  self.navigationController.navigationBarHidden = NO;
  self.title = @"Sign Up";
  
  UIButton *registerBtn = [UIButton buttonWithType:UIButtonTypeSystem];
  [registerBtn setTitle:@"Sign Up" forState:UIControlStateNormal];
  [registerBtn addTarget:self action:@selector(registerAction:) forControlEvents:UIControlEventTouchUpInside];
  [self.view addSubview:registerBtn];
  [registerBtn mas_makeConstraints:^(MASConstraintMaker *make) {
    make.center.mas_equalTo(0);
  }];
}

- (void)registerAction:(id)sender {
  if ([self.delegate respondsToSelector:@selector(registerViewControllerSucceedRegister:)]) {
    [self.delegate registerViewControllerSucceedRegister:self];
  }
}

@end
